function [profit,EYI_new,EYin_new,ProfitPart_new] = function_fQR_v1(Q,R,EYI,EYin,ProfitPart)
	global I ci cI r CURRENT % 主程序中定义
	EYI_new=EYI;
    EYin_new=EYin;
    ProfitPart_new=ProfitPart;
    Q_new = Q;
	R_new = R;
	cols = size(Q, 2);
	for n=1:cols
		Q_new(:, n) = r * (n - 1) * Q_new(:, n);
		R_new(:, n) = (n - 1) * R_new(:, n);
    end
        EYI_new(1, CURRENT)=sum(R_new(I, :));
        EYin_new(1, CURRENT)=sum(sum(R_new))/CURRENT;
		R_new = ci * R_new;
		R_new(I, :) = cI / ci * R_new(I, :);
        ProfitPart_new(1, CURRENT)=sum(sum(Q_new));
        ProfitPart_new(2, CURRENT)=ci*EYin_new(1, CURRENT)*CURRENT;%这就是作者错的地方，实际上不能用前面的EYin，应该单独算前I-1行。为了复现我这与原文保持一致
        ProfitPart_new(3, CURRENT)=sum(R_new(I, :));
	    profit = ProfitPart_new(1, CURRENT)-ProfitPart_new(2, CURRENT)-ProfitPart_new(3, CURRENT);     
	return;


